﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms; 
using System.Messaging;
using System.IO;

namespace MSMQRead
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            MessageQueue msgQueue = new MessageQueue(".\\private$\\ResultQueue-App-A");
            MessageEnumerator enumerator = msgQueue.GetMessageEnumerator2();
            enumerator.MoveNext();
            while (enumerator.Current != null)
            {
                System.Messaging.Message currentMsg = enumerator.Current;
                //MessageBox.Show(currentMsg.Formatter.Read(currentMsg).ToString());
                enumerator.MoveNext();
            }
        }
    }
}
